package com.kt.common.clazz.typealia

import java.io.File

fun main() {
    val f: (Int) -> Boolean = { it > 0 }

    println(foo(f)) // 输出 "true"

    val p: Predicate<Int> = { it > -3 }
    println(listOf(1, -2).filter(p)) // 输出 "[1]"

    //此处类型别名与其基础类型(以及具有相同基础类型的其他类型别名)是 赋值兼容 的
    val p1: Predicate1<Int> = { it > -1 }
    println(listOf(1, -2).filter(p1)) // 输出 "[1]"
}


// 别名
typealias FileTable<K> = MutableMap<K, MutableList<File>>

typealias MyHandler = (Int, String, Any) -> Unit



class A {
    inner class Inner{
        val a ="1"
    }
}
class B {
    inner class Inner
}

typealias AInner = A.Inner
typealias BInner = B.Inner

typealias Predicate<T> = (T) -> Boolean
typealias Predicate1<T> = (T) -> Boolean

fun foo(p: Predicate<Int>) = p(42)

